import wx
from ChartViewModel import ChartViewModel
from ChartControlView import ChartControlView
from ChartGridView import ChartGridView
from ChartHeaderView import ChartHeaderView

class ChartMainView(wx.Frame):
    
    def __init__(self, parent):
        try:
            wx.Frame.__init__(self, parent)
            
            self._chartViewModel = ChartViewModel.ChartViewModel()
            self._chartViewModel._chartModel.Get('IBM', 200, 1)

            self._chartControlView = ChartControlView(self)
            self._chartHeaderView = ChartHeaderView(self, wx.ID_ANY, label=self._chartViewModel._chartModel._header, style=wx.ALIGN_LEFT)
            self._chartGridView = ChartGridView(self, self._chartViewModel)

            chartGridView = wx.BoxSizer(wx.VERTICAL)
            chartGridView.Add(self._chartControlView, 1, wx.FIXED)
            chartGridView.Add(self._chartHeaderView, 2, wx.FIXED)
            chartGridView.Add(self._chartGridView, 3, wx.GROW)

            self.SetSizer(chartGridView)
            self.Show()
            
        except BaseException, e:
            print("ChartMainView.__init__ Error %s", e)